import request from '@/utils/request'
import { isNotEmpty } from '@/utils'
import { getItem } from '@/utils/auth'

export function fetchSequenceHistoryList(data) {
  return request({
    url: '/cloud-system/getSequenceHistoryList',
    method: 'post',
    data
  })
}

export function fetchSequenceHistoryOne(data) {
  return request({
    url: '/cloud-system/getOneSequenceHistoryDetail',
    method: 'post',
    data
  })
}

export function createSequenceHistory(data) {
  return request({
    url: '/cloud-system/createOneSequenceHistory',
    method: 'post',
    data
  })
}
export function updateSequenceHistory(data) {
  return request({
    url: '/cloud-system/updateOneSequenceHistory',
    method: 'post',
    data
  })
}

export function deleteSequenceHistory(data) {
  return request({
    url: '/cloud-system/deleteOneSequenceHistory',
    method: 'post',
    data
  })
}
export function batchDeleteSequenceHistory(data) {
  return request({
    url: '/cloud-system/batchDeleteSequenceHistory',
    method: 'post',
    data
  })
}

export function lockSequenceHistory(data) {
  return request({
    url: '/cloud-system/lockOneSequenceHistory',
    method: 'post',
    data
  })
}

export function unlockSequenceHistory(data) {
  return request({
    url: '/cloud-system/unlockOneSequenceHistory',
    method: 'post',
    data
  })
}

export function batchLockSequenceHistory(data) {
  return request({
    url: '/cloud-system/batchLockSequenceHistory',
    method: 'post',
    data
  })
}

export function batchUnLockSequenceHistory(data) {
  return request({
    url: '/cloud-system/batchUnLockSequenceHistory',
    method: 'post',
    data
  })
}

export function login(data) {
  return request({
    url: '/cloud-system/userLogin',
    method: 'post',
    data
  })
}

export function logout(data) {
  return request({
    url: '/cloud-system/userLogout',
    method: 'post',
    data
  })
}

export function createUser(data) {
  return request({
    url: '/cloud-system/createOneUser',
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: '/cloud-system/updateOneUser',
    method: 'post',
    data
  })
}

export function deleteUser(data) {
  return request({
    url: '/cloud-system/deleteOneUser',
    method: 'post',
    data
  })
}

export function getUserList(parameter) {
  const data = JSON.parse(getItem('baseParam'))
  if (isNotEmpty(parameter)) {
    data.parameterArray += (',' + parameter)
  }
  return request({
    url: '/cloud-system/getUserList',
    method: 'post',
    data: data
  })
}

export function getSequeceDefineList(parameter) {
  const data = JSON.parse(getItem('baseParam'))
  if (isNotEmpty(parameter)) {
    data.parameterArray += (',' + parameter)
  }
  return request({
    url: '/cloud-system/getSequeceDefineList',
    method: 'post',
    data: data
  })
}

